Take-home Exercise 1: Geospatial Analytics for Social Good

Author

Zheng Yimin

Published

November 30, 2022

1. Overview

In this exercise, we will use geospatial analytics to analyse spatial patterns of non-functional water points. We will be looking into Nigeria’s data for the purpose of this study. The below packages will be used for analysing and visualising the data:

  • the spdep package will be used for computation of Global and Local Measure of Spatial Autocorrelation (GLSA). This includes:

    • plotting of the Moran I scatterplot

    • computing and plotting the spatial correlogram by using appropriate functions within the package

    • computing the Local Indicator of Spatial Association (LISA) statistics. Specific functions will be used for the computations

    • computing the Getis-Ord’s Gi statistics to detect hot spot and/or cold spot areas by using appropriate functions within the package

  • specific functions of the sf package will be used to import the geospatial and aspatial data (shapefile format)

  • appropriate tidyr and dplyr methods will be used for deriving the proportion of functional and non-functional water point counts at Local Government Area (LGA) level.

  • the leaflet package will be used to produce interactive visualisation of Nigeria’s map

  • the tmap package will be used for visualisation of the analysis output, with respect to:

    • plotting of maps to show the spatial distribution of functional and non-functional water point counts at LGA level (thematic mapping technique).

    • plotting of hotspot areas and outliers/clusters maps of functional and non-functional water point counts at LGA level (thematic mapping technique).

2. Getting Started

2.1 The issue

Clean water is essential for survival, and thus is a valuable resource. However, over 40% of the global population still do not have access to sufficient clean water. This is especially common in the developing countries, where they are most affected by water shortages and poor water quality. Almost 80% of illnesses in the developing countries are caused by inadequacy of clean water and sanitation. This is especially prevalent in countries situated in the Africa continent.

To counter the issue of providing clean and sustainable water to the developing countries, the Water Point Data Exchange (WPdx) project is initiated. Its objective is to collect water point related data (based on WPDx Data Standard) from rural areas at the water point or small water scheme level, and publish the data on WPdx’s data repository. This repository is publicly accessible.

Above is the map of Nigeria, with its region color-coded based on various states within Nigeria. We will be using this map to help identify the regions in which the states belong to and complement our analysis in this exercise.

2.2 Objective

Hence, in this study, we are interested to examine the spatial patterns of water points in Nigeria, with particular focus on the Non Functional water points. Spatial Association techniques from various R packages will be used to develop our analysis.

2.3 The Data

Two sets of data will be used in this study:

2.3.1 Geospatial

Nigeria Level-2 Administrative Boundary (also known as Local Government Area) polygon features GIS data, extracted from geoBoundaries in shapefile format.

2.3.2 Aspatial

The WPdx+ data in shapefile format, extracted from WPdx Global Data Repositories.

2.4 Setting up the analytical tools

To ensure that the codes are properly run, the spdep, sf, tidyverse, leaflet and tmap packages will need to be installed in R.

  • spdep will be used for computation of spatial weights, spatial autocorrelation statistics;

  • sf will be used for importing and handling of geospatial data in R;

  • tidyverse will be used for wrangling attribute data in R; and

  • tmap will be used to prepare for visualisation of analysis output

  • leaflet will be used for interactive visualisations of analysis outout

  • funModeling will be used for rapid Exploratory Data Analysis

The code chunk below is used to create a package list containing the required R packages, and launching them into the R environment (assuming that these packages have already been installed in R).

pacman::p_load(spdep, sf, tidyverse, tmap, funModeling, leaflet)

3. Getting the Data into R Environment

In this section, we will be importing the geospatial and aspatial data into the R environment.

3.1 Importing the geospatial data into R Environment

st_read() of sf package is used to import the data in ESRI shapefile format.

nl2ab <- st_read(dsn = "data/geospatial",
                 layer = "geoBoundaries-NGA-ADM2",
                 crs=4326)
Reading layer `geoBoundaries-NGA-ADM2' from data source 
  `/Users/Yimin/ISSS624/Take-home_Ex/Take-home_Ex1/data/geospatial' 
  using driver `ESRI Shapefile'
Simple feature collection with 774 features and 5 fields
Geometry type: MULTIPOLYGON
Dimension:     XY
Bounding box:  xmin: 2.668534 ymin: 4.273007 xmax: 14.67882 ymax: 13.89442
Geodetic CRS:  WGS 84

3.2 Importing the aspatial data into R Environment

Next, we will use the same method to import the aspatial file into the environment as a simple feature data table.

nigeria <- st_read(dsn = "data/aspatial",
                 layer = "geo_export",
              crs=4326) %>%
  filter(clean_coun == "Nigeria")
Reading layer `geo_export' from data source 
  `/Users/Yimin/ISSS624/Take-home_Ex/Take-home_Ex1/data/aspatial' 
  using driver `ESRI Shapefile'
Warning: st_crs<- : replacing crs does not reproject data; use st_transform for
that
Simple feature collection with 406566 features and 72 fields
Geometry type: POINT
Dimension:     XY
Bounding box:  xmin: -92.05073 ymin: -27.31495 xmax: 92.32694 ymax: 26.65622
Geodetic CRS:  WGS 84
  • filter() of dplyr package is used to extract water point records of Nigeria.

The write_rds() function of the readr package is then used to save the output in rds format.

nigeria_nga <- write_rds(nigeria, "data/aspatial/nigeria_nga.rds")

4. Checking the content of the imported data

4.1 Using glimpse()

glimpse() of the dplyr package allows us to have an overview of the attributes present in the geospatial data.

glimpse(nl2ab)
Rows: 774
Columns: 6
$ shapeName  <chr> "Aba North", "Aba South", "Abadam", "Abaji", "Abak", "Abaka…
$ Level      <chr> "ADM2", "ADM2", "ADM2", "ADM2", "ADM2", "ADM2", "ADM2", "AD…
$ shapeID    <chr> "NGA-ADM2-72505758B79815894", "NGA-ADM2-72505758B67905963",…
$ shapeGroup <chr> "NGA", "NGA", "NGA", "NGA", "NGA", "NGA", "NGA", "NGA", "NG…
$ shapeType  <chr> "ADM2", "ADM2", "ADM2", "ADM2", "ADM2", "ADM2", "ADM2", "AD…
$ geometry   <MULTIPOLYGON [°]> MULTIPOLYGON (((7.401109 5...., MULTIPOLYGON (…

From the output above, we can see that all the columns except the ‘geometry’ column are in “chr” data type. The shapeName column features the various LGAs within Nigeria.

The st_crs() of sf package can be used to identify the coordinate system used in the data set.

st_crs(nl2ab)
Coordinate Reference System:
  User input: EPSG:4326 
  wkt:
GEOGCRS["WGS 84",
    ENSEMBLE["World Geodetic System 1984 ensemble",
        MEMBER["World Geodetic System 1984 (Transit)"],
        MEMBER["World Geodetic System 1984 (G730)"],
        MEMBER["World Geodetic System 1984 (G873)"],
        MEMBER["World Geodetic System 1984 (G1150)"],
        MEMBER["World Geodetic System 1984 (G1674)"],
        MEMBER["World Geodetic System 1984 (G1762)"],
        MEMBER["World Geodetic System 1984 (G2139)"],
        ELLIPSOID["WGS 84",6378137,298.257223563,
            LENGTHUNIT["metre",1]],
        ENSEMBLEACCURACY[2.0]],
    PRIMEM["Greenwich",0,
        ANGLEUNIT["degree",0.0174532925199433]],
    CS[ellipsoidal,2],
        AXIS["geodetic latitude (Lat)",north,
            ORDER[1],
            ANGLEUNIT["degree",0.0174532925199433]],
        AXIS["geodetic longitude (Lon)",east,
            ORDER[2],
            ANGLEUNIT["degree",0.0174532925199433]],
    USAGE[
        SCOPE["Horizontal component of 3D system."],
        AREA["World."],
        BBOX[-90,-180,90,180]],
    ID["EPSG",4326]]

As seen above, the nl2ab data set is currently using WGS 84 (geographic) coordinate system. However, using WGS 84 may not be appropriate if the analysis needs to use distance and/or area measurements, which is required in this exercise. We aim to transform the coordinate system to Nigeria’s projected coordinate system at the later stage of this exercise.

Next, let’s use glimpse() to take a look at nigeria’s data set.

glimpse(nigeria)
Rows: 95,008
Columns: 73
$ row_id      <dbl> 429068, 222071, 160612, 160669, 160642, 160628, 160632, 64…
$ source      <chr> "GRID3", "Federal Ministry of Water Resources, Nigeria", "…
$ lat_deg     <dbl> 7.980000, 6.964532, 6.486940, 6.727570, 6.779900, 6.955560…
$ lon_deg     <dbl> 5.120000, 3.597668, 7.929720, 7.648670, 7.664850, 7.779170…
$ date_repor  <date> 2018-08-29, 2015-08-16, 2020-12-04, 2020-12-04, 2020-12-0…
$ time_repor  <chr> "00:00:00.000", "00:00:00.000", "00:00:00.000", "00:00:00.…
$ status_id   <chr> "Unknown", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes"…
$ water_sour  <chr> NA, "Borehole", "Borehole", "Borehole", "Borehole", "Boreh…
$ water_so_2  <chr> NA, "Well", "Well", "Well", "Well", "Well", "Well", "Well"…
$ water_te_2  <chr> "Tapstand", "Mechanized Pump", "Hand Pump", NA, "Hand Pump…
$ X_water_tec <chr> "Tapstand", "Mechanized Pump", "Hand Pump", NA, "Hand Pump…
$ facility_t  <chr> "Improved", "Improved", "Improved", "Improved", "Improved"…
$ clean_coun  <chr> "Nigeria", "Nigeria", "Nigeria", "Nigeria", "Nigeria", "Ni…
$ clean_adm1  <chr> "Ekiti", "Ogun", "Ebonyi", "Enugu", "Enugu", "Benue", "Ben…
$ clean_adm2  <chr> "Moba", "Obafemi-Owode", "Ohaukwu", "Isi-Uzo", "Isi-Uzo", …
$ clean_adm3  <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
$ clean_adm4  <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
$ install_ye  <dbl> NA, NA, NA, NA, NA, NA, NA, 2016, 2016, 2015, 2016, NA, NA…
$ installer   <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
$ rehab_year  <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
$ rehabilita  <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
$ manageme_2  <chr> NA, "Other", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
$ status_cle  <chr> NA, "Functional", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, …
$ pay         <chr> NA, "No", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, …
$ fecal_coli  <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
$ fecal_co_2  <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
$ subjective  <chr> NA, "Acceptable quality", NA, NA, NA, NA, NA, NA, NA, NA, …
$ activity_i  <chr> "1a117ba2-5256-4801-874c-f7611a4499dd", NA, NA, NA, NA, NA…
$ scheme_id   <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
$ wpdx_id     <chr> "6FV7X4JC+222", "6FR5XH7X+R37", "6FR9FWPH+QVH", "6FR9PJHX+…
$ notes       <chr> "Tap Water", "Ajura", NA, NA, NA, NA, NA, NA, NA, NA, NA, …
$ orig_lnk    <chr> "https://nigeria.africageoportal.com/datasets/GRID3::grid3…
$ photo_lnk   <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
$ country_id  <chr> "NG", "NG", "NG", "NG", "NG", "NG", "NG", "NG", "NG", "NG"…
$ data_lnk    <chr> "https://catalog.waterpointdata.org/datasets/grid3-nigeria…
$ distance_t  <dbl> 767.3742, 13364.9005, 9492.7619, 9319.0815, 5437.7141, 159…
$ distance_2  <dbl> 921.79187, 48.87743, 4333.34280, 23276.33227, 18783.56566,…
$ distance_3  <dbl> 3146.733237, 4167.519068, 693.211204, 307.716194, 134.6120…
$ distance_4  <dbl> 41049.944, 13898.649, 27381.922, 34823.605, 40785.885, 469…
$ distance_5  <dbl> 959.365, 9405.783, 72060.118, 31665.447, 31240.904, 44105.…
$ water_poin  <chr> "{\"2018-08-29\": {\"source\": \"GRID3\", \"status_id\": \…
$ rehab_prio  <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 94, 628, 11742…
$ served_pop  <dbl> NA, 140, 0, 492, 868, 81, 0, 9969, 933, 1998, 4222, 94, 62…
$ local_popu  <dbl> NA, 887, 0, 492, 1919, 81, 0, 13740, 933, 11854, 22331, 26…
$ crucialnes  <dbl> NA, 0.1578354, NA, 1.0000000, 0.4523189, 1.0000000, NA, 0.…
$ pressure    <dbl> NA, 0.1400000, NA, 1.6400000, 2.8933333, 0.2700000, NA, 9.…
$ usage_cap   <dbl> 250, 1000, 300, 300, 300, 300, 300, 1000, 300, 300, 1000, …
$ is_urban    <chr> "True", "False", "False", "False", "False", "False", "Fals…
$ days_since  <dbl> 1483, 2592, 655, 655, 655, 655, 655, 2178, 2178, 2733, 211…
$ staleness_  <dbl> 62.65911, 44.17405, 81.34550, 81.34550, 81.34550, 81.34550…
$ is_latest   <chr> "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T", "T"…
$ location_i  <dbl> 358773, 264633, 397972, 397984, 397982, 397976, 397979, 32…
$ cluster_si  <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1…
$ clean_co_2  <chr> "NGA", "NGA", "NGA", "NGA", "NGA", "NGA", "NGA", "NGA", "N…
$ country_na  <chr> "Nigeria", "Nigeria", "Nigeria", "Nigeria", "Nigeria", "Ni…
$ water_so_3  <chr> "Tap", "Improved Tube well or borehole", "Borehole fitted …
$ water_tech  <chr> NA, "Motorised", NA, NA, NA, NA, NA, "Submersible", "India…
$ status      <chr> NA, "Functional (and in use)", NA, NA, NA, NA, NA, NA, NA,…
$ adm2        <chr> NA, "Obafemi-Owode", NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
$ adm3        <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
$ management  <chr> NA, "Other", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
$ adm1        <chr> NA, "Ogun", "Enugu", "Enugu", "Enugu", "Enugu", "Enugu", N…
$ lat_deg_or  <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
$ lat_lon_de  <chr> "(7.98?, 5.12?)", "(6.9645317?, 3.5976683?)", "(6.48694?, …
$ lon_deg_or  <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
$ public_dat  <chr> "https://catalog.waterpointdata.org/datafiles/grid3-nigeri…
$ converted   <chr> NA, "#status_id, #water_source, #pay, #status, #management…
$ count       <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1…
$ date_creat  <date> 2021-12-06, 2020-06-30, 2020-12-21, 2020-12-21, 2020-12-2…
$ time_creat  <chr> "21:12:57.000", "12:56:07.000", "19:26:15.000", "19:26:15.…
$ date_updat  <date> 2021-12-06, 2020-06-30, 2020-12-21, 2020-12-21, 2020-12-2…
$ time_updat  <chr> "21:12:57.000", "12:56:07.000", "19:26:15.000", "19:26:15.…
$ geometry    <POINT [°]> POINT (5.12 7.98), POINT (3.597668 6.964532), POINT …

The nigeria dataset imported shows a comprehensive list of information. We can see that under the clean_adm2 column, it features the names of LGAs in Nigeria.

5. Data wrangling

5.1 Checking duplicated LGA names in dataset

The code chunk below would tell us if duplicated names exist within the nl2ab data set.

nl2ab$shapeName[duplicated(nl2ab$shapeName)]
[1] "Bassa"    "Ifelodun" "Irepodun" "Nasarawa" "Obi"      "Surulere"

As we can see above, these are the LGAs with their names being duplicated. However, a quick check with Google will show that these duplicates are actually not errors. The Bassa area is both under the Kogi state and Plateau state. Ifelodun is in both Kwara, Ekiti, Lagos and Osun state. Irepodun is in Kwara, Ekiti and Osun state. In some of the states, Irepodun and Ifelodun are used interchangeably.

Nasarawa is both in Nasarawa and Kano state, Obi is in both Nasarawa and Benue, and Surulere is in Lagos and Oyo state. Hence, we will not be processing any data at this step.

5.2 Recording NA values into string

In the code chunk below, replace_na() is used to recode all the NA values in status_cle field into Unknown.

nigeria_nga <- read_rds("data/aspatial/nigeria_nga.rds") %>%
  mutate(status_cle = replace_na(status_cle, "Unknown"))

5.2 Exploratory Data Analysis (EDA)

freq() of funModeling package is then used to display the distribution of status_cle field in nigeria_nga.

freq(data=nigeria_nga,
     input = 'status_cle')
Warning: The `<scale>` argument of `guides()` cannot be `FALSE`. Use "none" instead as
of ggplot2 3.3.4.
ℹ The deprecated feature was likely used in the funModeling package.
  Please report the issue at <]8;;https://github.com/pablo14/funModeling/issueshttps://github.com/pablo14/funModeling/issues]8;;>.

                        status_cle frequency percentage cumulative_perc
1                       Functional     45883      48.29           48.29
2                   Non-Functional     29385      30.93           79.22
3                          Unknown     10656      11.22           90.44
4      Functional but needs repair      4579       4.82           95.26
5 Non-Functional due to dry season      2403       2.53           97.79
6        Functional but not in use      1686       1.77           99.56
7         Abandoned/Decommissioned       234       0.25           99.81
8                        Abandoned       175       0.18           99.99
9 Non functional due to dry season         7       0.01          100.00

5.3 Checking for outer islands

Next, we will use the leaflet() of the leaflet package to determine if there are any outer LGAs.

leaflet() %>% 
  addTiles() %>%
  addPolygons(data = nl2ab)

As we can see, there seems to be no outer LGAs and hence, we will not need to remove any LGAs for our further analysis.

6. Extracting Water Point Data

In this section, we will extract the water point records by using classes in status_cle field.

6.1 Extracting funtional water point

In the code chunk below, filter() of dplyr is used to select functional water points.

fn = nigeria_nga %>%
  filter(str_detect(`status_cle`, '^(Functional)'))
freq(data=fn,
     input = 'status_cle')

                   status_cle frequency percentage cumulative_perc
1                  Functional     45883      87.99           87.99
2 Functional but needs repair      4579       8.78           96.77
3   Functional but not in use      1686       3.23          100.00

6.2 Extracting non-functional water point

In the code chunk below, filter() of dplyr is used to select non-functional water points.

non_fn <- nigeria_nga %>% filter(status_cle %in%
                                         c("Abandoned/Decommissioned",
                                           "Abandoned",
                                           "Non-Functional",
                                           "Non-Functional due to dry season",
                                           "Non functional due to dry season"))
freq(data=non_fn,
     input = 'status_cle')

                        status_cle frequency percentage cumulative_perc
1                   Non-Functional     29385      91.25           91.25
2 Non-Functional due to dry season      2403       7.46           98.71
3         Abandoned/Decommissioned       234       0.73           99.44
4                        Abandoned       175       0.54           99.98
5 Non functional due to dry season         7       0.02          100.00

6.3 Extracting water point with Unknown class

In the code chunk below, filter() of dplyr is used to select water points with unknown status.

wpt_unknown <- nigeria_nga %>%
  filter(str_detect(`status_cle`, 'Unknown'))

7. Performing Point-in-polygon count

As we are required to compute the water point counts at LGA levels for the purpose of this study, the code chunk below will be executed, using st_intersects() and length(). Respective water point counts are added into new columns of nigeria_nga, based on the status of functionality of the water points.

nga_wp <- nl2ab %>% 
  mutate('total wpt' = lengths(st_intersects(nl2ab, nigeria_nga))) %>%
  mutate('wpt functional' = lengths(st_intersects(nl2ab, fn))) %>%
  mutate('wpt non-functional' = lengths(st_intersects(nl2ab, non_fn))) %>%
  mutate('wpt unknown' = lengths(st_intersects(nl2ab, wpt_unknown)))

8. Saving the analytical data table

First, we will find out the proportion of functional and non-functional water points at LGA levels.

  • mutate() of dplyr package is used to derive two fields namely pct_functional and pct_non-functional.
nga_wp <- nga_wp %>%
  mutate(pct_functional = `wpt functional`/`total wpt`) %>%
  mutate(`pct_non-functional` = `wpt non-functional`/`total wpt`)

We will also have to ensure that all null values (Na/NaN) are all changed to 0.

nga_wp[is.na(nga_wp)] = 0

Next, we will save the file in rds format.

write_rds(nga_wp, "data/aspatial/nga_wp.rds")

Note that this new file is only about 2.1mb, which means that there will be no issue pushing such a file to our github repository.

9. Visualising the spatial distribution of water points

Next, we will use tmap_arrange() to create visualisations of the water points for total water point counts, functional water point counts, non-functional water point counts and unknown water point counts at LGA levels.

nga_wp <- read_rds("data/aspatial/nga_wp.rds")
total <- qtm(nga_wp, "total wpt")
wp_functional <- qtm(nga_wp, "wpt functional")
wp_nonfunctional <- qtm(nga_wp, "wpt non-functional")
unknown <- qtm(nga_wp, "wpt unknown")

tmap_arrange(total, wp_functional, wp_nonfunctional, unknown, asp=1, ncol=2)

10. Working with projections

Map projection is an important aspect of geospatial data, and to ensure proper analysis at later steps, all data sets used in this data will follow Nigeria’s projected coordinate system (EPSG 26391).

10.1 Transforming EPSG code of geospatial data

st_transform() of sf package is used to transform the geospatial data from WGS 84 coordinate system to EPSG 26391. We will use it to transform the nl2ab data set into Nigeria’s projected coordinate system.

nga_wp26391 <- st_transform(nga_wp, crs=26391)

11. Geoprocessing with the sf package

In this section, we will use the geoprocessing (GIS analysis) functions under the sf package, to perform point-in-polygon count.

We can see that some of the values under the pct_functional and pct_non-functional column are Nan, and this should be changed to 0 in order to avoid any errors in further processing of the data / analysis.

We will use the code chunk below to change the Nan values.

nga_wp26391[is.na(nga_wp26391)] = 0

12. Global Spatial Autocorrelation

12.1 Computing Contiguity Spatial Weights

Here, we will use poly2nb() of spdep package to compute the contiguity weight matrices for the study area, by setting ‘queen’ to TRUE.

wm_q <- poly2nb(nga_wp26391,
                queen = TRUE)

summary(wm_q)
Neighbour list object:
Number of regions: 774 
Number of nonzero links: 4440 
Percentage nonzero weights: 0.7411414 
Average number of links: 5.736434 
1 region with no links:
86
Link number distribution:

  0   1   2   3   4   5   6   7   8   9  10  11  12  14 
  1   2  14  57 125 182 140 122  72  41  12   4   1   1 
2 least connected regions:
138 560 with 1 link
1 most connected region:
508 with 14 links

We can see that there are 774 regions in Nigeria, and the most connected LGA has 14 neighbours, and there are two LGAs with only 1 neighbour.

12.2 Row-standardised weights matrix

In this step, we will assign equal weights (style=“W”) to each of the neighbouring polygon.

set.ZeroPolicyOption(TRUE)
[1] FALSE
rswm_q <- nb2listw(wm_q,  
               style = "W",
               zero.policy = TRUE)

rswm_q
Characteristics of weights list object:
Neighbour list object:
Number of regions: 774 
Number of nonzero links: 4440 
Percentage nonzero weights: 0.7411414 
Average number of links: 5.736434 
1 region with no links:
86

Weights style: W 
Weights constants summary:
    n     nn  S0       S1       S2
W 773 597529 773 285.0658 3198.414

12.3 Moran’s I test

12.3.1 Computing Monte Carlo Moran’s I

The below code chunk performs Moran’s I statistical testing using moran.test() of spdep, for non-functional water point counts at LGA levels. 1000 simulations will be performed.

set.seed(1234)
bperm= moran.mc(nga_wp26391$`wpt non-functional`, 
                listw=rswm_q, 
                nsim=999, 
                zero.policy = TRUE, 
                na.action=na.omit)
bperm

    Monte-Carlo simulation of Moran I

data:  nga_wp26391$`wpt non-functional` 
weights: rswm_q  
number of simulations + 1: 1000 

statistic = 0.43393, observed rank = 1000, p-value = 0.001
alternative hypothesis: greater

As we can see, with a statistic value of 0.4339, it means there is positive spatial autocorrelation and that the non-functioning water points have a clustered pattern and observations surrounding it tend to be similar.

12.3.2 Visualising Monte Carlo Moran’s I

Next, we will plot the histogram of bperm using the hist() and abline() functions. We will need to first change the res value to become data frame.

summary(bperm$res[1:999])
      Min.    1st Qu.     Median       Mean    3rd Qu.       Max. 
-0.0651127 -0.0150421 -0.0020783 -0.0005316  0.0143726  0.0798599 
bperm1 = as.data.frame(bperm$res)

ggplot(data=bperm1, 
       aes(x=as.numeric(`bperm$res`))) + 
  geom_histogram(bins=25, color="black", fill="lightpink") + 
  labs(title= "ggplot histogram of bperm$res", x="Simulated Moran's I", y="Frequency") +
  geom_vline(xintercept=0, color="red")

As we can see, the observed statistic of 0.43393 falls way to the right of the distribution, suggesting positive spatial autocorrelation and that water points have a clustering pattern.

12.4 Geary C’s test

Here, we will use geary.test() of spdep package to compute spatial autocorrelation.

geary.test(nga_wp26391$`wpt non-functional`, listw=rswm_q)

    Geary C test under randomisation

data:  nga_wp26391$`wpt non-functional` 
weights: rswm_q 

Geary C statistic standard deviate = 14.457, p-value < 2.2e-16
alternative hypothesis: Expectation greater than statistic
sample estimates:
Geary C statistic       Expectation          Variance 
     0.6170907765      1.0000000000      0.0007014859 

With a low geary c statistic value of 0.61709 (less than 1), it also suggests that there is positive spatial autocorrelation and has a clustering pattern.

12.4.1 Computing Monte Carlo Geary C’s

We will use the below code chunk to compute Monte Carlo Geary’s C statistic using geary.mc() of spdep.

set.seed(1234)
bperm=geary.mc(nga_wp26391$`wpt non-functional`, 
               listw=rswm_q, 
               nsim=999)
bperm

    Monte-Carlo simulation of Geary C

data:  nga_wp26391$`wpt non-functional` 
weights: rswm_q 
number of simulations + 1: 1000 

statistic = 0.61709, observed rank = 1, p-value = 0.001
alternative hypothesis: greater

As observed from the output above, low statistic value of 0.61709 signifies that clustering patterns exist and there is positive spatial autocorrelation.

12.4.2 Visualising the Monte Carlo Geary C’s

hist(bperm$res, freq=TRUE, breaks=20, xlab="Simulated Geary c")
abline(v=1, col="red") 

The Geary C’s statistic value of 0.61709 falls way left to the histogram, implying similar conclusion to the Monte Carlo Geary C’s value.

13. Spatial Correlogram

We will next use spatial correlogram to examine patterns of spatial autocorrelation in the data.

13.1 Compute Moran’s I correlogram

sp.correlogram() of spdep package is used to compute a 6-lag spatial correlogram of Non-functional water points. plot() of base graph is then used to plot the output.

MI_corr <- sp.correlogram(wm_q, 
                          nga_wp26391$`wpt non-functional`, 
                          order=6, 
                          method="I", 
                          style="W")
plot(MI_corr)

We will then us the print() function to examine the results in full and supplement our findings above.

print(MI_corr)
Spatial correlogram for nga_wp26391$`wpt non-functional` 
method: Moran's I
           estimate expectation    variance standard deviate Pr(I) two sided
1 (773)  4.3393e-01 -1.2953e-03  4.7152e-04          20.0433       < 2.2e-16
2 (773)  2.6647e-01 -1.2953e-03  2.0206e-04          18.8374       < 2.2e-16
3 (773)  1.9507e-01 -1.2953e-03  1.2189e-04          17.7863       < 2.2e-16
4 (773)  1.4019e-01 -1.2953e-03  8.7589e-05          15.1181       < 2.2e-16
5 (773)  6.3735e-02 -1.2953e-03  6.8779e-05           7.8413       4.459e-15
6 (773)  2.1698e-02 -1.2953e-03  5.7380e-05           3.0354        0.002402
           
1 (773) ***
2 (773) ***
3 (773) ***
4 (773) ***
5 (773) ***
6 (773) ** 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

At lag distances 1-6, there is positive spatial autocorrelation since all Moran I’s estimates are positive. It also suggests that clustering pattern exists.

13.2 Compute Geary C’s correlogram

We will again use sp.correlogram() of spdep package to compute a 6-lag spatial correlogram of non-functional water points. The plot() of base Graph is then used to plot the output.

GC_corr <- sp.correlogram(wm_q, 
                          nga_wp26391$`wpt non-functional`, 
                          order=6, 
                          method="C", 
                          style="W")
plot(GC_corr)

Next we will use print() to print out the analysis report.

print(GC_corr)
Spatial correlogram for nga_wp26391$`wpt non-functional` 
method: Geary's C
          estimate expectation   variance standard deviate Pr(I) two sided    
1 (773) 0.61709078  1.00000000 0.00070149         -14.4573       < 2.2e-16 ***
2 (773) 0.74726091  1.00000000 0.00038571         -12.8689       < 2.2e-16 ***
3 (773) 0.80953972  1.00000000 0.00027325         -11.5219       < 2.2e-16 ***
4 (773) 0.86705201  1.00000000 0.00024463          -8.5002       < 2.2e-16 ***
5 (773) 0.94961811  1.00000000 0.00024087          -3.2462        0.001169 ** 
6 (773) 0.99919645  1.00000000 0.00026273          -0.0496        0.960462    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

14. Cluster and Outlier Analysis

14.1 Computing Local Moran’s I

The localmoran() function in the spdep package is used to compute the li values. The below code chunks are executed to compute local Moran’s I of non-functional Water Points at LGA levels.

fips <- order(nga_wp26391$shapeName)
localMoranI <- localmoran(nga_wp26391$`wpt non-functional`, 
                          rswm_q)
head(localMoranI)
           Ii          E.Ii       Var.Ii        Z.Ii Pr(z != E(Ii))
1 -0.32365786 -9.995243e-04 1.924638e-01 -0.73547576     0.46204980
2  0.07000542 -4.092463e-05 1.053077e-02  0.68258288     0.49487045
3  1.25819985 -1.627684e-03 4.181728e-01  1.94819847     0.05139122
4 -0.03537489 -5.427505e-05 5.954304e-03 -0.45773361     0.64714384
5  0.01201533 -2.590965e-04 3.988998e-02  0.06145673     0.95099547
6  0.00768085 -1.538445e-07 1.687859e-05  1.86960486     0.06153871

We will also use localmoran() to compute the Moran I’s value for functional water points at LGA levels.

localMoranI2 <- localmoran(nga_wp26391$`wpt functional`, 
                          rswm_q)
head(localMoranI2)
          Ii          E.Ii      Var.Ii      Z.Ii Pr(z != E(Ii))
1 0.43849688 -7.191834e-04 0.138521511 1.1801022      0.2379596
2 0.34159457 -2.904635e-04 0.074723729 1.2506933      0.2110464
3 0.69235062 -8.956670e-04 0.230277001 1.4446488      0.1485566
4 0.02080384 -3.884365e-04 0.042599612 0.1026774      0.9182190
5 0.30973779 -3.884365e-04 0.059795173 1.2682517      0.2047081
6 0.05824105 -4.231402e-05 0.004642162 0.8554300      0.3923132

localmoran() function returns a matrix of values whose columns are:

  • Ii: the local Moran’s I statistics

  • E.Ii: the expectation of local moran statistic under the randomisation hypothesis

  • Var.Ii: the variance of local moran statistic under the randomisation hypothesis

  • Z.Ii: the standard deviate of local moran statistic

  • Pr(): the p-value of local moran statistic

14.1.1 Mapping the local Moran’s I

Before mapping the local Moran I’s map, we will append the local Moran’s I data frame (localMoranI and localMoranI2 for non-functional and functional water points respectively) onto nl2ab26391 data frame. The appended data frame (i.e. SpatialPolygonDataFrame) is called nga_wp26391.localMoranI and nga_wp26391.localMoranI2 for non-functional water points and functional water points respectively.

nga_wp26391.localMoranI <- cbind(nga_wp26391,localMoranI) %>%
  rename(Pr.Ii = Pr.z....E.Ii..)
nga_wp26391.localMoranI2 <- cbind(nga_wp26391,localMoranI2) %>%
  rename(Pr.Ii = Pr.z....E.Ii..)

14.1.2 Mapping local Moran’s I values

We will now use the choropleth mapping functions within the tmap package to plot the local Moran’s I values for non-functional water points and functional water points.

nonfn <- tm_shape(nga_wp26391.localMoranI) +
  tm_fill(col = "Ii", 
          style = "pretty",
          palette = "RdBu",
          title = "local moran statistics (Non-functional Water points)") +
  tm_borders(alpha = 0.5)

fn <- tm_shape(nga_wp26391.localMoranI2) +
  tm_fill(col = "Ii", 
          style = "pretty",
          palette = "RdBu",
          title = "local moran statistics (Functional Water points)") +
  tm_borders(alpha = 0.5)

tmap_arrange(nonfn, fn, asp=1, ncol=2)
Variable(s) "Ii" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette.
Variable(s) "Ii" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette.

14.1.3 Mapping local Moran’s I p-values

It is also useful to consider the p-values of the li values plotted in the choropleth above. The code chunk below produces a choropleth map of Moran’s I p-values, by using functions within the tmap package. Again, we will first run the below code chunk to ensure that there are no Na values.

nga_wp26391.localMoranI[is.na(nga_wp26391.localMoranI)] = 0
nga_wp26391.localMoranI2[is.na(nga_wp26391.localMoranI2)] = 0

Both maps are plotted for the non-functional (left) and functional (right) water points.

non_fnp <- tm_shape(nga_wp26391.localMoranI) + 
  tm_fill(col = "Pr.Ii",
          breaks = c(-Inf, 0.001, 0.01, 0.05, Inf), 
          palette = "-Blues",
          title = "local Moran's I p-values (Non-functional water points)") +
  tm_borders(alpha = 0.5)

fnp <- tm_shape(nga_wp26391.localMoranI2) + 
  tm_fill(col = "Pr.Ii",
          breaks = c(-Inf, 0.001, 0.01, 0.05, Inf), 
          palette = "-Blues",
          title = "local Moran's I p-values (Functional water points)") +
  tm_borders(alpha = 0.5)

tmap_arrange(non_fnp, fnp, asp=1, ncol=2)

For the non-functional water points map, we can see that the top right (North East) regions had quite a big number of areas with non-functional water points, as their p-values is statistically higher (between 0.001 to 0.05).

Whilst for the functional water points map, the middle top corner (North West) of the functional water points are in deep blue, meaning that these regions had the most number of functional water points. Some areas within the North central region and South South regions also had the same occurrences.

15. Creating a LISA Cluster Map

The LISA cluster map shows significant locations color coded by type of spatial autocorrelation. We will first plot the Moran scatterplot.

15.1 Plotting Moran scatterplot

The Moran scatterplot illustrates the relationship between the values of the chosen attribute at each location and the average value of the same attribute at neighbouring locations.

Next, we will do up a Moran scatterplot of the non-functional water points at LGA levels using moran.plot() of spdep.

nci <- moran.plot(nga_wp26391$`wpt non-functional`, rswm_q,
                  labels=as.character(nga_wp26391$shapeName), 
                  xlab="Non Functional Water Pt Counts", 
                 ylab="Spatially Lag Non Functional Water Pt Counts")

As we can see, the top right corner are areas with high non-functional water point counts. Most of the regions are in the lower left region of the diagram.

15.2 Plotting Moran scatterplot with standardised variable

We will first use scale() to centers and scales the variable. Centering is done by subtracting the mean (omitting NAs) from the corresponding columns, and then dividing the (centered) variable by its standard deviations.

nga_wp26391$`Z.wpt non-functional` <- scale(nga_wp26391$`wpt non-functional`) %>% as.vector 

The as.vector() added to the end ensures that data type we get out of this is a vector mapped neatly into the dataframe.

We will then proceed to plot the Moran scatterplot.

nci2 <- moran.plot(nga_wp26391$`Z.wpt non-functional`, rswm_q,
                   labels=as.character(nga_wp26391$shapeName),
                   xlab="z-Non Functional Water Point Counts", 
                   ylab="Spatially Lag z-Non Functional Water Point Counts")

However, as the data is extremely cluttered especially for the lower left cluster, we will use LISA to supplement the visualisation and provide the analysis.

15.3 Preparing LISA map classes

We will then prepare a LISA cluster map next. Using vector(), we will define the quadrants for non-functional water points and functional water points.

For non-functional water points:

quadrant <- vector(mode="numeric",length=nrow(localMoranI))

For functional water points:

quadrant2 <- vector(mode="numeric",length=nrow(localMoranI2))

Now, we will compute the spatially lagged variable of interest (i.e. non functional water point counts and also the functional water point counts) and center the spatially lagged variable around the mean.

For non-functional water points:

nga_wp26391$`lag_wpt non-functional` <- lag.listw(rswm_q, nga_wp26391$`wpt non-functional`) 
DV <- nga_wp26391$`lag_wpt non-functional` - mean(nga_wp26391$`lag_wpt non-functional`) 

For functional water points:

nga_wp26391$`lag_wpt functional` <- lag.listw(rswm_q, nga_wp26391$`wpt functional`) 
DV1 <- nga_wp26391$`lag_wpt functional` - mean(nga_wp26391$`lag_wpt functional`) 

We will then center the local Moran around the mean.

For non-functional water points:

LM_I <- localMoranI[,1] - mean(localMoranI[,1])    

For functional water points:

LM_I1 <- localMoranI2[,1] - mean(localMoranI2[,1])    

And set a statistical significance level for the local Moran.

signif <- 0.05

The quadrants are distributed into 4 areas, namely the low-low(1), low-high(2), high-low(3), and high-high(4). These will be done for both the non-functional water points and the functional water points.

# for non-functional water points
quadrant[DV <0 & LM_I>0] <- 1
quadrant[DV >0 & LM_I<0] <- 2
quadrant[DV <0 & LM_I<0] <- 3  
quadrant[DV >0 & LM_I>0] <- 4  

# for functional water points
quadrant2[DV1 <0 & LM_I1>0] <- 1
quadrant2[DV1 >0 & LM_I1<0] <- 2
quadrant2[DV1 <0 & LM_I1<0] <- 3  
quadrant2[DV1 >0 & LM_I1>0] <- 4 

We will then place the non-significant Moran in category 0.

quadrant[localMoranI[,5]>signif] <- 0 # for non-functional water points
quadrant2[localMoranI2[,5]>signif] <- 0 # for functional water points

15.4 Plotting LISA map

Having done all the steps above, we can now plot the LISA map for non-functional water points. The left side of the map shows the local Moran I’s values and the right side shows its corresponding p-values.

non_fn_pts <- qtm(nga_wp26391, "wpt non-functional")

nga_wp26391.localMoranI$quadrant <- quadrant
colors <- c("#ffffff", "#2c7bb6", "#abd9e9", "#fdae61", "#d7191c")
clusters <- c("insignificant", "low-low", "low-high", "high-low", "high-high")

LISAmap <- tm_shape(nga_wp26391.localMoranI) +
  tm_fill(col = "quadrant", 
          style = "cat", 
          palette = colors[c(sort(unique(quadrant)))+1], 
          labels = clusters[c(sort(unique(quadrant)))+1],
          popup.vars = c("")) +
  tm_view(set.zoom.limits = c(11,17)) +
  tm_borders(alpha=0.5)

tmap_arrange(non_fn_pts, LISAmap, asp=1, ncol=2)

With the local Moran I (p-value) map, we can easily identify areas with significant non-functional water points. Similar to the observations drawn from the local Moran I maps plotted above (point 14.1.3), the low-low (North-east region) and high-high regions (North central regions, South South Regions and South-west region) are clustered and shows positive autocorrelation for non-functional water points at LGA levels.

Now, we will plot LISA maps for functional water points.

fn_pts <- qtm(nga_wp26391, "wpt functional")

nga_wp26391.localMoranI2$quadrant <- quadrant2
colors <- c("#ffffff", "#2c7bb6", "#abd9e9", "#fdae61", "#d7191c")
clusters <- c("insignificant", "low-low", "low-high", "high-low", "high-high")

LISAmap2 <- tm_shape(nga_wp26391.localMoranI2) +
  tm_fill(col = "quadrant", 
          style = "cat", 
          palette = colors[c(sort(unique(quadrant2)))+1], 
          labels = clusters[c(sort(unique(quadrant2)))+1],
          popup.vars = c("")) +
  tm_view(set.zoom.limits = c(11,17)) +
  tm_borders(alpha=0.5)

tmap_arrange(fn_pts, LISAmap2, asp=1, ncol=2)

Also similar to the local Moran I maps plotted in point 14.1.3, the North West region are in high-high quadrant, signifying positive spatial autocorrelation and clustering pattern exists.

16. Hot Spot and Cold Spot Area Analysis

Next, we will use localised spatial statistics to detect hot spot and/or cold spot areas.

16.1 Getis and Ord’s G-Statistics

The Getis and Ord’s G statistics is used to detect spatial anomalies, by looking at neighbours within specified proximity to identify high or low values cluster spatially.

16.2 Deriving distance-based weight matrix

Firstly, we will define a new set of neighbours by two types of distance-based proximity matrix:

  • Fixed distance weight matrix

  • Adaptive distance weight matrix

16.2.1 Deriving the centroid

To associate points with each polygon, we will compute the longitude and latitude values using the st_centroid() function. Once these values are obtained, we will use map_dbl() to output the values as vectors.

longitude <- map_dbl(nga_wp26391$geometry, ~st_centroid(.x)[[1]])
latitude <- map_dbl(nga_wp26391$geometry, ~st_centroid(.x)[[2]])

Next, we will use cbind() to put longitude and latitude into the same object coords.

coords <- cbind(longitude, latitude)

16.2.2 Determine the cut-off distance

We will then determine the upper limit for distance band using the steps below:

  • using knearneigh() of spdep to output matrix with indices of points belonging to set of the k nearest neighbours of each other.

  • using knn2nb() to convert the knn object returned by knearneigh() into neighbours list of class nb with list of integer vectors that contains neighbour region number ids.

  • using nbdists() of spdep to output length of neighbour relationship edges in units of the coordinates if coordinates are projected, in km otherwise.

  • using unlist() to remove list structure of returned object

k1 <- knn2nb(knearneigh(coords))
k1dists <- unlist(nbdists(k1, coords))
summary(k1dists)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   2669   12834   20304   22084   27783   72139 

As we can see, the upper limit will be 72139m. Any distance below this value will have at least one neighbour.

16.2.3 Computing fixed distance weight matrix

Next, we will use dnearneigh() to compute the distance weight matrix.

wm_d62 <- dnearneigh(coords, 0, max(k1dists))
wm_d62
Neighbour list object:
Number of regions: 774 
Number of nonzero links: 18130 
Percentage nonzero weights: 3.026327 
Average number of links: 23.42377 

We will now use nb2listw() to convert the nb object into spatial weights object.

wm62_lw <- nb2listw(wm_d62, style = 'W')
summary(wm62_lw)
Characteristics of weights list object:
Neighbour list object:
Number of regions: 774 
Number of nonzero links: 18130 
Percentage nonzero weights: 3.026327 
Average number of links: 23.42377 
Link number distribution:

 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 
 5  9 11 22 32 35 33 34 29 35 27 18 21 23 16 12 12 11 16 17 16 10 14 10  5 13 
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 
12  5 15 13 12  7 10  8 12  5 12 17 14  9 10  4  5  3  7  6 11  8  5  5  4  2 
53 54 55 56 57 58 59 60 61 62 63 64 65 67 68 70 
 3  3  6  3  5  6  2  5  5  8  6  6  4  3  1  1 
5 least connected regions:
90 112 123 237 670 with 1 link
1 most connected region:
585 with 70 links

Weights style: W 
Weights constants summary:
    n     nn  S0       S1       S2
W 774 599076 774 130.3659 3126.725

16.3 Computing adaptive distance weight matrix

In this case, we will control the number of neighbours directly using knn2b() and specifying the number of neighbours.

knn <- knn2nb(knearneigh(coords, k=8))
knn
Neighbour list object:
Number of regions: 774 
Number of nonzero links: 6192 
Percentage nonzero weights: 1.033592 
Average number of links: 8 
Non-symmetric neighbours list

Now we will use nb2listw() to convert nb object into spatial weights object.

knn_lw <- nb2listw(knn, style = 'B')
summary(knn_lw)
Characteristics of weights list object:
Neighbour list object:
Number of regions: 774 
Number of nonzero links: 6192 
Percentage nonzero weights: 1.033592 
Average number of links: 8 
Non-symmetric neighbours list
Link number distribution:

  8 
774 
774 least connected regions:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 with 8 links
774 most connected regions:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 with 8 links

Weights style: B 
Weights constants summary:
    n     nn   S0    S1     S2
B 774 599076 6192 11154 201940

17. Computing Gi statistics

17.1 GI statistics using fixed distance (for non-functional water points)

gi.fixed <- localG(nga_wp26391$`wpt non-functional`, wm62_lw)
gi.fixed
  [1] -3.4117746649 -3.4325327295 -1.5896654726  0.1024035837 -1.4372020951
  [6]  2.8392431096 -1.2451608781 -2.0881598529  0.6943166939 -4.1357148773
 [11] -3.5543643584  0.7028327021  1.0557642518 -1.2648020444 -3.1100102991
 [16]  4.4236791649  0.7253370351 -0.1170313444 -0.8468860707  0.1418378466
 [21] -0.4444525907 -2.5787439152 -5.9408386919  0.0490221299 -4.6250101263
 [26] -3.4526479798 -3.2842327545  2.6307586789  3.1531206419  3.9017827701
 [31] -0.3901172116 -2.0709442943 -0.1348087246  2.5315321685  0.4465304476
 [36]  2.8157847314  2.0572944746  2.3429395384  2.1827306253  1.9238345799
 [41]  2.1897325824 -0.3645157327 -3.8639919963  4.5399631849  4.3061500016
 [46]  2.9608766578 -0.2864102817  1.1746065746 -2.8181694612  3.0318488026
 [51] -2.3715234853 -5.9628191057 -4.8665465676 -5.9978486948 -2.1521995859
 [56] -2.6990377972 -4.1095164521 -4.2582561763  0.1434597247 -1.4480552039
 [61] -0.3664736626 -2.0660238126  1.3560050446  1.1941723552  0.6520255991
 [66] -0.7061126715  5.3705428742 -3.9654078235 -2.8742418968  4.4607142525
 [71]  5.9817295202  0.3589544407 -0.0717557313 -0.2146512615  1.2805963197
 [76]  2.5430378175 -4.3209911455 -6.1864779959 -6.3091804665 -5.2074212405
 [81]  1.5724065864 -3.0134148246 -1.6605766843  2.1372905711 -1.9370094219
 [86]  0.5351722462  0.7781339095 -0.0991617191  0.0206765657  1.6845537280
 [91] -1.9481984678  2.4106784274 -0.1209884988 -0.0294216102  1.2014584129
 [96]  0.5487724545  0.5230691396 -1.0049421880  2.2086577453  0.6860104564
[101] -0.8358802808  3.3934885075 -2.5915246147  0.7361865356 -1.3919152488
[106]  1.6857908883  3.3349825302  1.4948688424 -0.6649376028  0.1049808942
[111]  0.1797402897 -0.2296312591  1.5924606930 -0.4220300892 -2.4843821512
[116] -0.5403453732  2.4425124231  3.1901956500  3.7026209747  5.7708188247
[121] -2.9992528883 -2.8867680713  0.1450845287  5.6181447864  0.1300463875
[126] -1.4642795114  0.1064214435  0.2019905157 -0.3933126058 -1.0687092481
[131]  1.1862683742 -1.2897330306  2.0774178384 -2.7261489805  1.1595913792
[136]  0.0590529868  0.0415312576 -0.1479027888  0.2286220369 -1.8068739793
[141]  1.8128875616 -1.8465165657 -1.9263347704 -0.1217435299  0.1562862363
[146] -2.0483697898 -0.1728823598  1.1206769217  2.2828808379 -1.2897776976
[151]  2.4167160591  0.3088772578 -0.1569586843  1.5067812784 -1.4232058416
[156] -1.3192224285 -3.7789524190 -1.1745401808 -1.6603243945 -2.5183861649
[161]  0.0497131757  0.5395983509  2.4584177542  1.7817721289 -5.8940988934
[166]  0.5616363675  1.6014174947 -0.7737526146 -1.8608470741  1.2807175799
[171]  1.8546118600  5.6507070121  4.9899574161  3.8565952505  5.4648235612
[176] -0.6763153032 -2.1820247405  1.1201091686  5.1137113602 -1.0998628514
[181] -4.9652045029  3.5387758960 -2.3886751887 -0.4653196107  4.1348276862
[186]  3.5932572298  3.8543059497  5.2228382133 -5.6296206205 -2.9734659505
[191] -3.8503251289  3.5127403382 -2.4310631930 -3.0070376123 -3.2384084218
[196] -3.0486056593 -2.0595597139 -2.5844113063 -3.5641507085 -1.7577329410
[201]  0.3786055236 -0.5079560968 -1.9294510731 -3.7986404726 -2.7848792901
[206] -2.5102897931 -1.9939528637 -2.3691669213 -0.9886885003 -2.0151263289
[211] -0.9581884502 -0.7245577589  3.5470212834 -2.4820784778 -5.6010575750
[216] -4.0749852290  0.3576511087  0.2927426140 -1.6443111430  0.8302229411
[221] -0.5062515700 -0.1547202287 -2.4843821512  1.0086589118 -2.1770380403
[226]  2.4626146208  0.0440638219  0.1920286012  1.3983932449 -0.8496076016
[231] -0.6691384516 -1.2911170263  1.5345894073 -0.5529326952 -1.5457781106
[236] -1.0324483227  1.1200463362 -0.0620637069  0.4247713032  2.0054718680
[241] -1.4942460433 -1.1521974135 -0.2921554734 -2.4950665627  3.5976949011
[246] -2.7962939270  4.8434048492 -2.5148770948 -1.1267981706 -2.2240242508
[251] -0.2630217751 -2.1970004876 -0.7730147072  0.6798537235  1.2492399224
[256] -0.6888953395  0.8358603199  1.6654804315 -0.4827650151 -0.5433051006
[261] -2.7605516416 -0.8707537202  0.0947302301 -2.0368588754  0.0696307201
[266] -0.6203604939 -2.3237912877  0.3598097208  0.3526946680  1.4430576168
[271] -1.8702382558 -0.1272890978 -2.2962397403 -2.7219828700  0.2521141177
[276]  0.2110907859 -0.0140816269 -0.4035735646 -0.1936101468 -3.4726936093
[281] -1.1266733840 -1.0891489463 -0.8054781266 -3.1021011147 -0.2258676440
[286] -0.4264717884  1.5869426397 -0.6349762230 -1.8844344179  3.0598056534
[291] -5.6709166021 -5.4830137576 -5.5819971667 -5.6384828208 -0.5824687042
[296]  5.3088751125 -2.6487517374  5.7673863636  4.9440575555  3.7543412120
[301]  4.2490060765  6.6608670387  3.8590463207  4.3840930783  4.6799452358
[306] -2.6462032630  4.3397784922 -2.4054408070 -3.4238843779 -2.5120530221
[311] -2.7147690002 -2.6317957384 -5.5485595954 -4.2448418644  1.3083580350
[316] -0.0008175288 -0.5453801285 -2.0157446995  4.7484630417  2.6229111706
[321] -2.5261266494 -3.2713201180 -2.9903547011  1.6380043965 -4.6631468209
[326] -2.3492073446 -3.3004858380  4.4178197031  4.0780178934  3.5616720390
[331] -1.2136320131 -2.7979941928 -2.0118940444 -1.5111729044 -2.2358982231
[336] -3.9541762690  2.0820588544 -2.6099148033  6.6557659546  1.0903162691
[341]  4.4835629508  6.0629547434  6.0427221000  6.1036461610 -1.0477720725
[346]  6.6228782572  4.9953238917  5.1302151080  0.5368152260  1.0651968009
[351] -0.8283153141 -2.4311349096  0.8470591553  0.3745724752  5.5209564889
[356]  5.4927540484  5.2676551986  2.0959129929 -0.6275540802  4.1792561383
[361] -0.0590747566 -1.4318034953 -1.8389648967 -3.7859879826 -3.7817839487
[366] -5.4245454867  5.8696037200 -4.6411506929  1.6117911279 -2.6522843897
[371] -2.9391365455 -5.4894734274  0.8980569535  0.1738054683 -0.1017873640
[376] -2.9644127980 -0.3483319452  2.5906642146  2.5757689632  2.8049352195
[381] -1.8542483216  0.4788736337  0.3119912756  0.9113252618 -1.0636046195
[386]  1.2128128576  2.3166975797 -2.4409676368  1.3341470252  1.2361156601
[391]  2.1848914329  1.9356540658  1.1829505160 -2.1398569553  1.5986911707
[396]  3.5405748932  4.2315968938  1.4478008085  0.7997941089 -2.4579198656
[401]  1.7729143861 -0.2688161324  1.1759997435 -0.4785272245  0.0824185174
[406] -1.9481984678  1.8474148195  2.0216768147  0.6370561918 -1.0801487314
[411]  1.8849519770 -0.4439225392 -2.1627301474 -0.9568239420 -2.1208906249
[416]  1.9959594097  1.8550481979  0.0768132901  0.6124793401  1.3560776058
[421]  2.3411474563  1.5216483269  2.8604474525 -0.5765991732  1.1856817116
[426]  0.8921599476  0.9184331234  1.0249162410  1.3154778076 -2.2722342410
[431] -0.7116331447  1.6931894763  0.6730570517 -1.1800027342 -0.5199578683
[436]  0.4808652570 -0.0235257009  0.8165479237 -3.0529318612 -2.0225625108
[441]  2.9455769746  0.2363832344 -2.2768267875  0.3466223084  3.2255102937
[446]  0.1411952313 -1.9481984678 -2.1661859263 -0.4676066168 -1.6782098794
[451] -0.0777842289  1.4868205720 -0.3505589498 -0.1726887164  3.8745989532
[456]  2.7346136617 -0.9465537461 -0.8931548108  1.3012749110  1.5028765507
[461] -2.2932985630 -2.2505626380  0.7936258264  2.4032040546  2.3557037349
[466]  0.1826814641  0.1072325498  1.2844732698 -0.8760327358  1.7752129147
[471]  0.2516184985  1.2342409373 -2.0753935530 -1.8558057677 -2.5640880571
[476] -0.2895493962 -2.0222513579  1.9291991379 -2.0461307940  1.7044807663
[481] -2.1018239835  2.2216843179 -0.0429522457  0.4370541700  1.0787307424
[486] -0.8407609199  2.7630963689  1.3973854719 -1.0153143497  0.3214749983
[491]  2.0826454414 -2.2510480140 -0.9777552530 -0.2462903412  1.3294858918
[496] -1.1545484236 -1.5476742545 -5.2094566914  0.0549402737 -2.6381224548
[501]  1.2684806683  3.0942547654 -0.1945298933 -0.3139665937 -1.4312402705
[506]  6.0035680834 -1.5896654726  1.7438033643 -2.7605516416  3.6248484270
[511]  3.2842322630 -2.5504783218 -2.2884473891 -1.2742029215 -2.1794770390
[516] -0.9452868662  0.9226508131 -0.2808815183 -1.3017627523  0.1028146689
[521]  0.7903470822 -4.7773019724 -4.0599839099 -2.8929329559 -2.2510480140
[526] -2.5436200487  0.5572826624 -4.0077436082  0.5743933705  0.7561771796
[531] -5.4711387856 -5.9881769115 -1.7097095914 -3.2145613317 -5.4921528592
[536] -5.6065224752 -5.8927691095 -0.5158206706 -0.6169568186 -0.3646687228
[541] -3.1236269572 -0.6335776619 -5.7248166602 -2.7991201431  3.1510854408
[546]  0.8119571110  1.5362711705 -3.3968533218 -3.8153771055  5.9423980975
[551] -2.1187346870 -3.8748698800  2.7449840241  3.5912450649 -1.5471567880
[556]  1.1545459720  4.7634173376 -3.2694968198 -0.1539058338  5.4349953766
[561] -1.4215986299 -4.1250618121 -2.1372786039 -5.4053629216 -3.3734475553
[566]  3.1846656426  3.3148834211  2.8896814604  3.1830364814  2.1415338074
[571] -2.6827643843  1.3599575208 -5.5189330179 -0.3658278560 -4.8168371931
[576] -1.0570272459 -0.2384946211 -1.1607522581 -5.6452073745 -2.2576555531
[581]  1.7975786222  4.6952651933  1.4302665280  1.3989314523 -5.3349149523
[586]  1.4675795928 -0.2318308926 -2.7751843183 -1.2798894874 -3.2243185582
[591]  3.7238463041 -1.9040602801  5.3597510246  0.3377758326 -0.6590453290
[596]  0.5564706605 -3.6996922635  0.2560104627  4.2395964721  3.9198676182
[601] -0.7367636763 -5.4524005156 -5.3185082518 -0.8488602190 -1.9028377268
[606] -1.0064673530 -0.3045753085 -2.8225903216  2.5443505078  4.6794907143
[611] -5.7372577835  5.3162941702  0.0533854848 -5.5653175208 -5.4554505787
[616] -5.3342170944 -2.0355539983 -6.2184435395 -5.6475542692  1.4165917345
[621] -4.8095950608 -5.3585676554 -2.4123005609 -3.7802073197  5.7231828185
[626] -0.4207639553 -0.0820196887  0.4913428569  1.9668518061  1.0669220785
[631] -4.3830103212 -4.0535150724 -4.2297431678  2.9774246125  4.2206187107
[636] -5.8592562511 -2.6995188099  1.5314942716 -0.0111640361  4.9598342782
[641] -0.8975285513  3.2695447281 -3.3804769565  1.0233101789 -3.3797348722
[646]  0.6090977147  2.9539283043 -1.1786140304 -0.0727091531 -0.8216517560
[651] -2.6810951026  0.2470088329  1.2742462639 -1.9488365342  1.0167687803
[656]  2.4696394873  0.9420722071  0.4885664676  3.1287725372 -0.9497319744
[661]  2.4425891604 -0.2105136963 -3.5070892894  0.8476063553 -0.4188028499
[666] -0.1801619339  2.1839721672  2.9349648477 -2.3517158696  0.6303115465
[671] -2.9726649671 -0.3251973156  0.5816313363 -0.3216700089 -1.8966498040
[676] -2.4477520834  2.1462680474 -0.7007776964 -0.2901563432 -0.6294507710
[681]  3.1848222332 -2.2628381729 -0.1928257328  3.7543250494 -0.6898963477
[686] -0.4579363450 -2.8263574815 -1.9107113505  1.9767736485  1.3356841113
[691] -0.1992862573  2.1555107134 -2.1759945372  3.8196059687  1.3667153170
[696]  1.5606747950 -2.8180979983  0.1258362477  1.6362250633 -1.1755606793
[701]  0.0556083826 -0.6254612030 -1.8245553490  1.7673690255 -1.7099082238
[706]  0.5061058989 -1.8322536644 -0.4720914115  1.2302888089 -0.2537342611
[711] -1.0194530184 -1.4775673577 -0.0896050089 -1.1801300237 -2.3509568161
[716] -4.6307512034 -2.7407326147 -0.0025370071 -3.0988099215 -3.1167461569
[721] -3.4662013761 -1.4743456301 -1.9718471619  2.1607674145 -2.9497681287
[726] -3.3579719453 -3.6200569828 -4.8364896839 -3.6643604569 -3.4079170777
[731] -1.2277114161 -5.4597614286  0.0712972970 -0.1507192365  2.3528477525
[736]  1.8167556955 -2.5958296857 -0.4791719568 -3.9373952476  4.0454927846
[741] -0.8497222111  4.1914248594 -1.3905853881 -1.1087182179 -1.5160448019
[746] -2.6117513854 -2.7085894788  0.0867810375  1.8316046394 -1.3189997474
[751]  0.6456167365 -0.8342620760 -0.2755550651 -0.1319774555  3.8329382654
[756]  3.9433436976  1.4629084755  2.5181371643  2.4671867473  1.4737976377
[761]  1.0618293805 -3.2385810885 -2.9516603752 -2.9891644936  0.2150638765
[766] -1.2461555271 -0.1547825213  0.7644963108  2.3956916991  3.1096694186
[771]  3.4527292514 -0.9854012267 -1.0503779238  0.1911170626
attr(,"cluster")
  [1] Low  Low  Low  Low  Low  High Low  Low  High Low  Low  High Low  Low  High
 [16] High Low  High Low  High High Low  Low  High Low  Low  Low  High High High
 [31] Low  Low  Low  High High High Low  High High High High High Low  Low  Low 
 [46] High High High High Low  Low  Low  Low  Low  Low  Low  Low  Low  Low  Low 
 [61] Low  Low  High Low  High Low  High Low  Low  High High Low  High Low  High
 [76] Low  Low  Low  Low  Low  High High High Low  High Low  Low  Low  High High
 [91] Low  High High High High High High Low  High Low  Low  High Low  High High
[106] Low  High High High High Low  High Low  Low  Low  High Low  High High High
[121] Low  Low  Low  High Low  Low  Low  Low  Low  Low  High Low  High Low  High
[136] Low  High Low  High Low  Low  High Low  High High Low  Low  High High Low 
[151] Low  High Low  High High Low  Low  High Low  Low  High Low  High High Low 
[166] Low  Low  High Low  Low  High High Low  High Low  Low  Low  Low  High Low 
[181] Low  High Low  Low  High Low  High High Low  Low  Low  Low  Low  Low  Low 
[196] High Low  Low  Low  Low  High High Low  Low  Low  Low  Low  Low  Low  Low 
[211] Low  Low  High Low  Low  Low  High High Low  Low  High Low  Low  High Low 
[226] Low  Low  Low  Low  High Low  Low  High Low  High High High Low  High High
[241] Low  High Low  Low  High Low  Low  Low  Low  Low  Low  Low  Low  High High
[256] Low  Low  Low  Low  Low  Low  High High Low  High Low  Low  High Low  High
[271] Low  High Low  Low  Low  High Low  Low  Low  Low  High Low  High High Low 
[286] Low  Low  Low  Low  High Low  Low  Low  Low  Low  Low  Low  High High High
[301] High Low  High High High Low  High Low  Low  Low  Low  Low  Low  Low  Low 
[316] Low  Low  Low  High High Low  Low  Low  Low  Low  Low  Low  High High High
[331] Low  High Low  Low  Low  Low  High High High Low  High Low  High High High
[346] Low  Low  High Low  Low  Low  Low  High Low  High High Low  High Low  Low 
[361] Low  High High Low  Low  Low  High Low  High Low  Low  Low  Low  Low  High
[376] Low  High High Low  High Low  Low  Low  High Low  High High Low  Low  High
[391] Low  High Low  Low  High High Low  Low  Low  Low  High High High High Low 
[406] Low  High High High Low  High Low  High Low  High High High Low  Low  High
[421] High Low  High Low  High High Low  Low  Low  Low  Low  Low  High High High
[436] High High High Low  Low  High Low  Low  Low  High High Low  Low  Low  High
[451] High High Low  High High High High Low  High High Low  Low  Low  High Low 
[466] Low  High Low  High High Low  Low  Low  Low  Low  High Low  High Low  High
[481] Low  High Low  Low  Low  Low  High High Low  High Low  Low  High Low  High
[496] High Low  Low  Low  Low  Low  High Low  Low  High Low  Low  High Low  High
[511] High Low  Low  Low  Low  High High Low  High High High High Low  Low  Low 
[526] Low  High Low  Low  Low  Low  Low  Low  Low  Low  Low  Low  High Low  High
[541] Low  Low  Low  Low  High High High High High High High Low  High High Low 
[556] High High Low  High High Low  Low  Low  Low  Low  Low  High High High Low 
[571] Low  Low  High Low  High High High Low  Low  Low  Low  High High High Low 
[586] High High Low  Low  Low  Low  Low  High Low  Low  Low  Low  High High High
[601] High Low  Low  Low  Low  Low  Low  High Low  High Low  High Low  Low  Low 
[616] Low  High Low  Low  High Low  Low  Low  Low  High Low  Low  Low  Low  Low 
[631] Low  Low  Low  High High Low  Low  Low  Low  High Low  High Low  High Low 
[646] Low  High Low  Low  Low  Low  High Low  Low  Low  High High High High High
[661] Low  Low  High High Low  High High High Low  Low  High Low  High Low  Low 
[676] Low  High Low  High Low  High Low  Low  High Low  Low  Low  Low  High Low 
[691] High High Low  High Low  Low  Low  High High High High Low  Low  High Low 
[706] High Low  Low  High Low  High High High High Low  Low  Low  High Low  Low 
[721] High Low  Low  High High High Low  Low  Low  Low  Low  Low  Low  Low  High
[736] High Low  High Low  High Low  High High Low  Low  Low  Low  High High Low 
[751] High Low  High High High High High High High Low  Low  Low  Low  Low  High
[766] Low  Low  High Low  Low  High High High Low 
Levels: Low High
attr(,"gstari")
[1] FALSE
attr(,"call")
localG(x = nga_wp26391$`wpt non-functional`, listw = wm62_lw)
attr(,"class")
[1] "localG"

17.2 GI statistics using fixed distance (for functional water points)

gi.fixed2 <- localG(nga_wp26391$`wpt functional`, wm62_lw)
gi.fixed2
  [1] -4.796625452 -4.760127962 -1.178785579 -0.326632935 -4.719062957
  [6]  1.517212583 -1.636993159 -1.695772874 -0.403511962 -5.192667725
 [11] -2.471730819 -0.360194196 -1.160778305 -1.048919594 -2.076653373
 [16] -0.319638712  0.024689628 -1.279528653 -2.184358587  0.671272845
 [21] -1.467560160 -2.129890631 -5.395088806 -0.580180689 -5.492909851
 [26] -2.856737649 -2.398488558  0.047876305  0.553566085 -0.678752505
 [31] -1.789058701 -1.699530361  7.316382777 -0.942117552 -0.317227940
 [36]  0.968416640 -1.200000231 -1.215937811 -1.250145921 -0.936269120
 [41] -0.910234791 -2.557053584 -2.572245517 -0.245002701 -0.469438413
 [46]  0.825048029  5.756223602 -0.421474825 -2.324341929  0.510629133
 [51] -1.821113251 -5.020218376 -4.343323299 -5.375838607 -3.325401823
 [56] -2.969247964 -3.966133856 -4.171384714  0.537673286 -2.373367425
 [61] -1.782872370 -1.690458718  0.473188658  0.020869639 -0.415531935
 [66] -3.067787075  1.992162779 -3.388560862 -2.035881783  0.530433344
 [71]  0.847801225  0.365894907 -0.067751286 -0.717387481 11.826518178
 [76]  0.262941721 -3.986267972 -5.146568258 -5.390420086 -4.411184786
 [81]  7.785389163 -1.870888986  2.675295892 -0.649933863  3.530210517
 [86] -2.247765303  1.959302045 -0.015345175 -0.190454738  0.454287567
 [91] -1.444648763  0.405372773 -0.527594795 -1.272494469  2.337994156
 [96]  3.059431706  2.564387687  1.378633502  6.979930628  0.001564852
[101]  3.806723860  1.323933872 -3.925948341 -1.551585805  4.530615529
[106]  0.622169130  1.408970398  3.516041825 -1.068989857  9.734034046
[111]  6.482245919 -0.708388269 -0.283322572  1.623796935 -1.411235908
[116] -1.019433470  2.652150834 -0.026674040  1.210758111  1.020998329
[121] -2.973029029 -3.232857918 -0.041267240  1.139442966 -0.136961972
[126] -1.440738782  5.784211632  0.064853642  0.895275119  4.981130457
[131] -0.411512020  0.325452007  0.172847407 -2.700297960 -0.112748651
[136] -2.858250519 -2.838335027 -0.031623823  3.140725380 -1.193741467
[141]  0.522647406  4.508306655 -1.154123902  0.704778882  7.244848174
[146] -1.322736593  3.838917300 -0.586271732  2.749348898 -1.062816081
[151]  3.437193610 -0.281080288  1.432006743  3.624933666  5.219108034
[156]  4.356464086 -3.061522216 -1.864230015 -1.433320898 -1.867460383
[161]  2.021045256 -1.079001217  0.339194758 -0.447683844 -5.194088009
[166]  7.760826012  3.612672340  2.401521545 -3.932711535  0.664912955
[171]  1.512273278  0.938478908  0.877369107  2.049958651  0.162107516
[176] -0.780169159 -1.776622291 -0.232742053  1.177679490 -1.958249110
[181] -5.336864791  0.487651859 -2.222023494 -3.701647793 -0.049111229
[186] -1.027213498 -0.293338282 -0.018656587 -5.109795341 -3.827711792
[191] -3.433668692 -0.733587774 -2.131616581 -2.627586230 -2.918359053
[196] -2.274341511 -2.736576378 -2.864461007 -3.383692993 -2.557124598
[201] -1.333668024 -3.391773644 -4.825810986 -4.606650954 -3.175497220
[206] -2.867346895 -1.804087100 -4.739652812 -4.267580760 -2.738349519
[211] -2.347372314 -2.474379980  0.825138188 -2.068665055 -4.763993663
[216] -5.268924373 -0.533951036 -0.772989095  4.557586316 -0.694389743
[221]  1.278381807 -0.756156627 -1.656765229 -1.005568662 -0.896133518
[226]  2.809332022  8.354696578 -0.758299913 11.681333158  3.960443970
[231]  1.395070355 -0.913989702  9.627442737  4.464755359  3.564663269
[236] -1.019280116  1.193759164  7.337585009  0.658425019  0.197956077
[241] -0.855453847  6.575205038  2.118679253 -1.651707593  3.025034229
[246] -3.753207455  1.048332054 -1.377765271 -0.894505578 -1.625910419
[251] -0.796121151 -0.988626661 -0.858111837 -0.663893717 12.608127293
[256] -0.771550024 -0.597118254  9.121334761  1.119804276 -0.288001999
[261] -2.047033493 -1.172374899 -0.501966928  4.111155011 -0.716706941
[266]  2.382601004  3.193389546  0.362312513 -0.959050742  5.031261684
[271] -1.337552563 11.576955247 -1.028792533 -1.787378470 -0.470180105
[276] -0.502208652 -0.652681839 -0.853539673 -0.956358177 -3.261683102
[281] -0.967771709 -1.226585251 -0.811129233 -2.058593671 -3.210784851
[286] -4.155345305  0.083233454 -4.196967277 -2.319192417 -0.879575112
[291] -5.291308127 -5.233489238 -5.022486870 -4.990068236 -1.191126097
[296]  0.130496233 -2.086680957  0.995783450  0.866892685  0.184191908
[301]  0.086049850  0.910955413 -0.427232759  0.555528771  1.139116792
[306] -2.141361286  2.187696902 -2.716023426 -3.145170658 -2.768852333
[311] -3.110955366 -2.767284563 -5.074599898 -5.192175741 -1.210258524
[316] -1.061349688 -1.335899179 -1.918120770  0.049399810 -0.831074214
[321] -4.681728334 -3.450328584 -3.254580827  2.890974503 -5.162884377
[326] -1.924517173 -2.401959634 -0.243078163 -0.582886865  1.123837553
[331] -4.543179697 -2.211761815 -4.193800219 -4.437604156 -2.454835521
[336] -4.018574657  0.608915921 -4.859336908  1.414270027 -1.171354641
[341]  0.150724307  0.455738714  0.901511376  1.019687962 -1.060399635
[346]  2.255010806  1.391019329  1.495476178 -0.075388339  4.187221209
[351] -3.851821661 -1.749320356 -1.410399401 -0.021632801  0.930382428
[356]  1.365480441 -0.018931327  0.005817083 -0.168563045 -0.485986137
[361] -0.484249142 -1.417805617 -1.515965814 -4.977917778 -5.213675809
[366] -5.590074894  0.881763487 -4.710816211 -0.173435639 -2.930649869
[371] -2.938433264 -5.257577674  7.023817384 -0.271167944 -4.007786754
[376] -3.560458147 -0.545226216  0.348443768  1.393525041  2.228234375
[381] -1.212173377 10.838099292  4.371615765  0.358111148  4.909400053
[386] -0.394511268  1.699144153 -1.332539251  2.778761672  1.367938928
[391]  1.320968959  1.551561688 -1.048588108  3.837240499  1.584691637
[396]  1.115839697  0.639524891 11.470507367  3.421581590 -1.618267467
[401]  0.213636057 -0.459527822  1.705318137 -0.705319616  3.071688138
[406] -1.444648763 -0.078634839  0.098406863  1.537395142  2.804091023
[411]  2.309925920  3.427154442  3.965427065  3.952811115  3.072023737
[416]  0.726832712  0.132805960  3.570025169  0.941352179  2.711444669
[421] -0.316905589 11.233904555  1.683157859  0.728690673  2.651708893
[426]  5.772870369  0.160263416 -0.523765424  0.423539121 -4.036772436
[431]  4.170377169  0.195347084 10.668447414  2.636073077  7.034217507
[436] -0.281880919 -0.840855141  0.517222625 -2.892012170 -0.964731329
[441]  0.913504498 -0.543487200 -1.904511471  2.394610100  3.031288248
[446] -0.340552895 -1.444648763  4.113454879  5.633695682  4.386881730
[451]  3.020799932  0.273621954  3.934527167 -0.691096555  0.146836074
[456]  0.009168543 -1.351386142 -0.802780323  0.158640466 -0.124417745
[461] -1.905751410 -1.912332128  0.116134126  1.290096633  0.902548864
[466] -0.669277435 -0.217957776  1.091254914  3.348737032 -0.114691377
[471] -0.856100785  9.760066190 -1.396983244  3.471012235 -1.439260520
[476] -0.752254689 -0.964492350  3.133094811 -1.393075179 11.948654838
[481] -1.501515087 -0.409336688  6.072071581 -0.965177123 11.638289782
[486]  3.233374934  1.180539651  3.671335818  0.461306989 -0.093857516
[491]  3.206315280 -1.669220966 -0.413175040 -0.273174855  2.562061728
[496]  3.391949313 -1.217187644 -5.280562950 -2.913323179 -1.869068047
[501] 12.064659197  1.680179622  6.564044722  0.576123433 -4.314693740
[506]  0.629795831 -1.178785579  1.492122521 -2.047033493 -0.082337499
[511]  1.554329806 -1.728352594 -1.518590300  3.316965071 -1.804856692
[516] -0.583244682 -0.906380264  0.450314370  5.381473154 -0.667446407
[521]  0.422279063 -4.302374032 -3.771714953 -2.380037977 -1.669220966
[526] -1.415829273 -0.641250019 -4.851016718  6.211651959  3.938191286
[531] -5.195686970 -5.139598941 -1.756215464 -2.882285526 -5.245338863
[536] -5.071953823 -5.286543500 -3.716139511 -4.328454710 -3.854149448
[541] -3.027582794 -0.284900738 -5.395088806 -2.249736287  0.133247051
[546]  0.073992826  0.217852297 -4.874333782 -3.753213232  0.985441134
[551] -4.791128129 -5.211656303  0.950499332  0.517108316 -1.869664783
[556] -1.146531548  1.117959037 -2.341930567 -3.543739104  1.681084059
[561] -2.310126370 -3.937355743 -2.316417257 -4.916239685 -2.772400468
[566]  1.236927982  1.267611661  0.828620928  1.323539884 -1.071737798
[571] -3.497359599 -1.215096208 -4.971266793 -2.348748787 -4.806522801
[576] -1.938484036 -0.072570764 -1.535446830 -4.981964770 -1.613906573
[581]  0.147102299  0.364812306 -0.928180477 -1.247173587 -5.238629947
[586] -1.222164805 -3.417372903 -3.080764397 -1.281221193 -3.616303055
[591]  0.747655733 -2.695619973  1.372386391  0.256835839 -1.464872920
[596] -1.138292853 -4.632880375 -0.547087849 -0.170421337 -0.364653986
[601] -1.539901265 -5.041257274 -4.949977276 -3.919692587 -3.633383487
[606] -2.015060482 -0.053057022 -3.058184167  0.843561948 -0.115457327
[611] -5.286374412  1.448806166 -3.093782525 -5.184191438 -5.103751262
[616] -5.056914979 -4.580323409 -5.395336072 -5.211957343 -1.030740355
[621] -4.442438142 -4.891078483 -1.905089871 -4.848541421  1.042783655
[626] -0.933521080 -1.725757299 -1.578334320 -1.334625788 -1.373906347
[631] -4.946643305 -4.880382733 -4.704975190 -0.650212735 -0.426436675
[636] -5.130487789 -4.203410114  0.282767107  0.119850186  1.479392840
[641] -0.635906805  1.909771456 -3.044687684  0.353207517 -3.829186494
[646]  0.418824207  0.898803860 -0.906961587  0.028979705  4.388939152
[651] -2.134547844 -0.456914208  3.153506676  3.576618272  9.930828226
[656]  1.695982298  3.056510198  5.529311522  2.516549120 -0.337972241
[661]  2.646170360  1.997954458 -3.166389295  0.022313786 -0.419392738
[666] -0.342921112  5.299017107  1.625515929 -2.674159065  0.130543877
[671] -2.136536281 -0.887675659 -0.563561615  0.063096291  3.823165614
[676] -1.625979327  0.627332458 -0.201908284  3.900410812 -0.347418483
[681]  0.942563138 -1.826892675 -1.112467595  2.186997876 -1.245330711
[686] -1.190044003 -1.891662435 -2.105935630 10.350787059 -0.337105364
[691]  3.598497939 -0.491822793 -1.901093612  1.200709980 -0.432468898
[696]  2.497383872 -3.932329218  5.221825815 -0.308320259 -0.314178162
[701] -0.473236569 -0.962888102  4.406659616 -0.360587467 -0.634760959
[706] 12.361068286  3.923729833  1.181451124 -0.450717965 -0.418407023
[711]  1.460055636  4.204376179  4.122884460 -0.521867733 -2.532490578
[716] -3.992227392 -3.083281004 -2.932672169 -3.223978470 -3.183501018
[721] -4.717349805 -2.466711855 -4.471958981  0.099389149 -4.700632055
[726] -4.432996943 -3.504302818 -4.642299957 -4.873111351 -4.984575890
[731]  5.714913828 -5.377716835 -3.806473939 -3.248909650  0.254710871
[736] -0.108873831 -3.135488840 -4.259266866 -3.622987073  0.614108705
[741] -1.157639496  1.254706976  5.595439342  1.987261504 -2.120742126
[746] -2.692078268 -2.540128344 -0.174533571  0.590994961  4.932692386
[751] -0.551209120 -1.015083034  0.695728059 -0.867531486  0.033480721
[756]  0.332591811 -0.365589801  1.445315978  0.422824450  5.204034617
[761] -0.382892599 -2.585082666 -2.027483188 -1.954050814 -0.206151257
[766] -0.488255728  3.645713886  6.548154322  4.889046907  1.668672912
[771]  1.937819738 -0.855511005  0.667817716  0.003316460
attr(,"cluster")
  [1] Low  Low  Low  Low  Low  High Low  High High Low  Low  Low  Low  Low  High
 [16] High Low  High Low  Low  Low  Low  Low  Low  Low  Low  Low  High High High
 [31] Low  Low  High Low  High High Low  High High Low  High Low  Low  Low  Low 
 [46] High High Low  High High Low  Low  Low  Low  Low  Low  Low  Low  Low  Low 
 [61] Low  Low  High Low  High Low  High Low  Low  High High Low  Low  Low  High
 [76] Low  Low  Low  Low  Low  High High High High High Low  High High High High
 [91] Low  High High Low  Low  High High High High Low  High Low  Low  Low  High
[106] High High High Low  High High Low  High High High Low  High High High Low 
[121] Low  Low  High High High Low  High Low  Low  High High High High Low  Low 
[136] Low  Low  Low  High Low  Low  High Low  Low  High Low  Low  Low  High Low 
[151] Low  Low  High Low  High High Low  Low  Low  Low  Low  Low  High Low  Low 
[166] High Low  High Low  High High High High High Low  Low  Low  Low  High Low 
[181] Low  High Low  Low  High Low  Low  High Low  Low  Low  Low  Low  Low  Low 
[196] High Low  Low  Low  Low  Low  Low  Low  Low  Low  Low  Low  Low  Low  Low 
[211] Low  Low  Low  Low  Low  Low  High High Low  Low  High Low  Low  High Low 
[226] Low  High Low  High High High Low  High High High High High High High High
[241] Low  High High Low  High Low  Low  Low  Low  Low  Low  Low  Low  Low  High
[256] Low  Low  High Low  Low  Low  Low  Low  High High High Low  Low  Low  High
[271] Low  High Low  Low  Low  High Low  Low  High Low  High Low  High Low  Low 
[286] Low  Low  Low  Low  Low  Low  Low  Low  Low  Low  Low  Low  Low  High Low 
[301] High Low  Low  High Low  Low  High Low  Low  Low  Low  Low  Low  Low  Low 
[316] Low  Low  Low  Low  Low  Low  Low  Low  High Low  Low  Low  Low  Low  Low 
[331] Low  High Low  Low  Low  Low  High Low  High Low  Low  Low  Low  Low  Low 
[346] High Low  High Low  High Low  Low  Low  Low  High Low  Low  Low  Low  Low 
[361] Low  High Low  Low  Low  Low  High Low  Low  Low  Low  Low  High Low  Low 
[376] Low  High High High Low  Low  High Low  Low  High High High High Low  Low 
[391] Low  Low  Low  Low  High Low  High High High Low  Low  High High High High
[406] Low  Low  High High High High High High Low  Low  Low  High High Low  High
[421] Low  High High High High High Low  Low  Low  Low  High Low  High High High
[436] Low  Low  Low  Low  Low  High Low  Low  High Low  Low  Low  Low  High High
[451] High High High High Low  Low  High Low  High Low  Low  Low  Low  High Low 
[466] High High Low  High Low  Low  Low  Low  High Low  Low  Low  High High High
[481] Low  Low  High Low  High High High High Low  Low  High Low  High Low  Low 
[496] High Low  Low  Low  Low  Low  High High High Low  Low  Low  High Low  Low 
[511] High Low  Low  High Low  Low  High Low  Low  High High Low  Low  Low  Low 
[526] Low  Low  Low  High High Low  Low  Low  Low  Low  Low  Low  Low  Low  Low 
[541] Low  Low  Low  Low  Low  High Low  Low  High High Low  Low  High High Low 
[556] Low  High Low  Low  High Low  Low  Low  Low  Low  High Low  High High Low 
[571] Low  Low  Low  Low  High High High Low  Low  Low  High High Low  Low  Low 
[586] Low  Low  Low  Low  Low  High Low  High Low  Low  Low  Low  Low  Low  Low 
[601] High Low  Low  Low  Low  Low  Low  Low  High High Low  Low  Low  Low  Low 
[616] Low  Low  Low  Low  Low  Low  Low  Low  Low  High Low  Low  Low  Low  Low 
[631] Low  Low  Low  High Low  Low  Low  Low  Low  High Low  High Low  High High
[646] Low  High Low  High High Low  Low  Low  High High High High High High Low 
[661] Low  High Low  High Low  Low  Low  High Low  Low  Low  Low  Low  Low  Low 
[676] Low  High High High High High Low  Low  High Low  Low  Low  Low  High Low 
[691] High Low  Low  High Low  High Low  High High High Low  Low  Low  High Low 
[706] High High High High Low  High High High Low  Low  Low  Low  Low  Low  Low 
[721] Low  Low  Low  Low  Low  Low  Low  Low  Low  Low  High Low  Low  Low  Low 
[736] High Low  Low  Low  Low  Low  Low  High High Low  Low  Low  High Low  High
[751] High Low  High Low  Low  Low  High High High High Low  Low  Low  Low  High
[766] Low  Low  High High High High High High Low 
Levels: Low High
attr(,"gstari")
[1] FALSE
attr(,"call")
localG(x = nga_wp26391$`wpt functional`, listw = wm62_lw)
attr(,"class")
[1] "localG"

We will now use cbind() to join the Gi values corresponding to the nga_wp26391 data frame (for both functional and non-functional water points) using the code below. The code will first convert gi.fixed into r.matrix object using as.matrix() and then produce a new SpatialPolygonDataFrame named nga_wp26391.gi. It will then rename the field name of gi values to gstat_fixed using rename().

# for non-functional water points
nga_wp26391.gi <- cbind(nga_wp26391, as.matrix(gi.fixed)) %>%
  rename(gstat_fixed = as.matrix.gi.fixed.) 
# for functional water points
nga_wp26391.gi2 <- cbind(nga_wp26391, as.matrix(gi.fixed2)) %>%
  rename(gstat_fixed = as.matrix.gi.fixed2.)

17.4 Mapping Gi values with fixed distance weights

Next, we will use the code below to map the Gi values based on fixed distance weight matrix.

Gimap <-tm_shape(nga_wp26391.gi) +
  tm_fill(col = "gstat_fixed", 
          style = "pretty",
          palette="-RdBu",
          title = "local Gi (non-functional)") +
  tm_borders(alpha = 0.5)

tmap_arrange(non_fn_pts, Gimap, asp=1, ncol=2)
Variable(s) "gstat_fixed" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette.

As we can see on the right of the map (local Gi map), the hot spot areas are in red color whilst the cold spot areas are in blue. The regions in south east of Nigeria had colder spots whilst regions between North Central and South West had hotter spots, as denoted by its bright red colors with local Gi values between 4-8. These areas seemed to contain more non-functional water points.

The below map shows the interpretation for functional water points at LGA levels.

Gimap2 <-tm_shape(nga_wp26391.gi2) +
  tm_fill(col = "gstat_fixed", 
          style = "pretty",
          palette="-RdBu",
          title = "local Gi (functional)") +
  tm_borders(alpha = 0.5)

tmap_arrange(fn_pts, Gimap2, asp=1, ncol=2)
Variable(s) "gstat_fixed" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette.

We can also see from the local Gi map above, the North west regions had more hot spots, as visualised by the dark red colors.

17.5 Gi statistics using adaptive distance

We will then use the code below to compute the Gi values for nga_wp26391 using adaptive distance weight matrix.

For non-functional water points:

gi.adaptive <- localG(nga_wp26391$`wpt non-functional`, knn_lw)
nga_wp26391.gi <- cbind(nga_wp26391, as.matrix(gi.adaptive)) %>%
  rename(gstat_adaptive = as.matrix.gi.adaptive.)

For functional water points:

gi.adaptive2 <- localG(nga_wp26391$`wpt functional`, knn_lw)
nga_wp26391.gi2 <- cbind(nga_wp26391, as.matrix(gi.adaptive2)) %>%
  rename(gstat_adaptive = as.matrix.gi.adaptive2.)

17.6 Mapping Gi values with adaptive distance weights

Now we will use the tmap package to create choropleth maps with the respective Gi values for non-functional water points and functional water points.

For non-functional water points:

Gimap <- tm_shape(nga_wp26391.gi) + 
  tm_fill(col = "gstat_adaptive", 
          style = "pretty", 
          palette="-RdBu", 
          title = "local Gi (non-functional)") + 
  tm_borders(alpha = 0.5)

tmap_arrange(non_fn_pts, 
             Gimap, 
             asp=1, 
             ncol=2)
Variable(s) "gstat_adaptive" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette.

Overall, the maps highlighted areas which are deeply clustered in blue (negative Gi values) to be similar to the local Moran I’s maps.

For functional water points:

Gimap2 <- tm_shape(nga_wp26391.gi2) + 
  tm_fill(col = "gstat_adaptive", 
          style = "pretty", 
          palette="-RdBu", 
          title = "local Gi") + 
  tm_borders(alpha = 0.5)

tmap_arrange(fn_pts, 
             Gimap2, 
             asp=1, 
             ncol=2)
Variable(s) "gstat_adaptive" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette.

The results in these maps for the functional water points also corresponds to the local Moran I maps above as well.

17.6 Which spatial weights is better?

The adaptive distance weights based matrix seems to show a more coherent results with the local Moran I maps than as compared to the fixed weights distance based matrix. Adaptive distance weights based may be the best choice here since polygon contiguity is only effective if polygons are similar in size and distribution, which is not for Nigeria’s case.

The fixed distance is also less advisable here since it works better with polygon data that has large variation in polygon sizes. In this exercise, the LGAs varies in sizes across the whole Nigeria, so fixed distance may be less accurate here.

Other methods would include the inverse method. It would also not be advisable in this case since the data set used for analysis is a large dataset and computations may be exhaustive.

18. Conclusions

Whilst the analysis were helpful in identifying various LGAs in Nigeria which had functional and non-functional water points, it also signifies underlying issues within these states. In a study conducted by World Bank in 2017, the urban areas within Nigeria had better access to water and sanitation than as opposed to rural areas within Nigeria. Certain states within the South West regions faced water contamination due to issues including equipment failure (Sangodoyin, 1993), whilst many are abandoned due to institutional and economic factors. In Akwa Ibom, issues such as improper maintenance, low community involvement, inadequate cooperation amongst stakeholders and other political factors were all reasons for the unsustainability of rural water supply.

It is also worrisome to note that out of 95008 water points in Nigeria, 33.08% are non-functioning water points. With a growing emphasis in attaining Sustainability Development Goals (SDG), it is imperative that Nigeria step up its efforts to improve the number of functional water points and bring in more clean water and better sanitation.

Hopefully, with these visualisations in place, it helps Nigeria to better identify key spots with high non-functioning water points and improve on it.

19. References

Amoye, T. (2021, August 18). Nigeria does not need the creation of new states. Vanguard News. https://www.vanguardngr.com/2021/08/nigeria-does-not-need-the-creation-of-new-states/

Andres, L. et. al (2018, March). Why Are So Many Water Points in Nigeria Non-Functional? Retrieved November 28, 2022, from https://openknowledge.worldbank.org/bitstream/handle/10986/32436/9781464814402.pdf